﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="HomeDetail.ascx.cs" Inherits="UserControl_HomeDetail" %>
<link href="../Css/Printscreen.css" rel="stylesheet" type="text/css" />
<div id="page-main-content-title">
    &nbsp;<asp:Label ID="lblTitle" runat="server" CssClass="title-item" Text="Sản phẩm "></asp:Label>
</div>
<asp:DataList ID="DataList1" runat="server" DataSourceID="sdsLoai" Width="100%">
    <ItemTemplate>
        <div class="title-bg">
            <div class="title">
                <asp:Label ID="Label2" runat="server" Font-Bold="true" Text='<%# Eval("TenLoai") %>'></asp:Label>
                <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# "~/DanhSach.aspx?LoaiID="+ Eval("ID") %>'
                    CssClass="linkBold" Font-Size="10px">( Xem nhiều hơn )</asp:HyperLink>
            </div>
        </div>
        <table cellpadding="0" cellspacing="0" width="100%">
            <tr>
                <td>
                    <asp:DataList ID="DataList2" runat="server" CssClass="bodyHomeDetail" DataKeyField="MaSanPham"
                        DataSourceID="sdsSanPham" RepeatColumns="3" Style="text-align: center" RepeatDirection="Horizontal"
                        Width="100%">
                        <ItemStyle Width="245px" />
                        <ItemTemplate>
                            <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td>
                                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                            <tr>
                                                <td width="11">
                                                    <img src="image/tbl_pro1.jpg" width="11" height="11">
                                                </td>
                                                <td background="image/tbl_pro2.jpg">
                                                    <img src="image/tbl_pro2.jpg" width="1" height="11">
                                                </td>
                                                <td width="11">
                                                    <img src="image/tbl_pro3.jpg" width="11" height="11">
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                            <tr>
                                                <td width="11" style="background-image: url(image/tbl_pro4.jpg); background-repeat: repeat-y;
                                                    background-position: left top">
                                                    &nbsp;
                                                </td>
                                                <td>
                                                    <asp:Label ID="Label7" runat="server" Style="font-weight: 700; color: #060606; font-size: 14px"
                                                        Text='<%# Eval("MaSanPham") %>'></asp:Label>
                                                </td>
                                                <td width="11" style="background-image: url(image/tbl_pro5.jpg); background-repeat: repeat-y;
                                                    background-position: right top">
                                                    &nbsp;
                                                </td>
                                            </tr>
                                            <tr>
                                                <td width="11" style="background-image: url(image/tbl_pro4.jpg); background-repeat: repeat-y;
                                                    background-position: left top">
                                                    &nbsp;
                                                </td>
                                                <td>
                                                    <div align="center">
                                                        <asp:ImageButton ID="ImageButton2" runat="server" Height="220px" ImageUrl='<%# Eval("URL") %>'
                                                            PostBackUrl='<%# "~/SanPham.aspx?ID="+Eval("MaSanPham") %>' ToolTip="Click để xem chi tiết"
                                                            Width="220px" />
                                                    </div>
                                                </td>
                                                <td width="11" style="background-image: url(image/tbl_pro5.jpg); background-repeat: repeat-y;
                                                    background-position: right top">
                                                    &nbsp;
                                                </td>
                                            </tr>
                                            <tr>
                                                <td width="11" style="background-image: url(image/tbl_pro4.jpg); background-repeat: repeat-y;
                                                    background-position: left top">
                                                    &nbsp;
                                                </td>
                                                <td height="20" class="info">
                                                    Thể loại<span class="style1" style="text-align: left"> :
                                                        <asp:Label ID="Label9" runat="server" Text='<%# Eval("TenLoai") %>'></asp:Label>
                                                        <br />
                                                    </span>Giá :&nbsp;<asp:Label ID="Label11" runat="server" Style="color: #FF0000" Text='<%# Eval("GiaBan", "{0:N0}") %>'></asp:Label>
                                                    &nbsp;VNĐ
                                                </td>
                                                <td width="11" style="background-image: url(image/tbl_pro5.jpg); background-repeat: repeat-y;
                                                    background-position: right top">
                                                    &nbsp;
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                            <tr>
                                                <td width="11">
                                                    <img src="image/tbl_pro6.jpg" width="11" height="36">
                                                </td>
                                                <td background="image/tbl_pro7.jpg" style="padding-bottom: 3px">
                                                    <div align="center">
                                                        <table border="0" cellspacing="0" cellpadding="0">
                                                        </table>
                                                    </div>
                                                </td>
                                                <td width="11">
                                                    <img src="image/tbl_pro8.jpg" width="11" height="36">
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                    </asp:DataList>
                    <asp:SqlDataSource ID="sdsSanPham" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectServer %>"
                        SelectCommand="SELECT TOP (6) (select top 1 URL from HinhAnh where HinhAnh.MaSanPham=SanPham.MaSanPham) as URL ,SanPham.MaSanPham, SanPham.GiaBan, SanPham.NgayCapNhat, SanPham.LoaiID, SanPham.Xoa, SanPham.GioiThieu, SanPham.ChucNangID, SanPham.NhanHieuID, Loai.TenLoai, NhanHieu.Ten AS TenNhanHieu, ChucNang.Ten AS TenChucNang FROM SanPham INNER JOIN Loai ON SanPham.LoaiID = Loai.ID INNER JOIN NhanHieu ON SanPham.NhanHieuID = NhanHieu.ID LEFT OUTER JOIN ChucNang ON SanPham.ChucNangID = ChucNang.ID WHERE (SanPham.LoaiID = @LoaiID) AND (SanPham.Xoa = 0) order by SanPham.NgayCapNhat DESC">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="hfLoaiID" Name="LoaiID" PropertyName="Value" Type="Int32" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                    <asp:HiddenField ID="hfLoaiID" runat="server" Value='<%# Eval("ID") %>' />
                </td>
            </tr>
        </table>
    </ItemTemplate>
</asp:DataList>
<asp:SqlDataSource ID="sdsLoai" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectServer %>"
    SelectCommand="SELECT * FROM [Loai] where ID in(select LoaiID from sanpham group by LoaiID) and Xoa=0 order by SapXep ASC">
</asp:SqlDataSource>
